﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="wfPVehicleMange.aspx.cs" Inherits="msBsc.WebUi.ShpMana.wfPVehicleMange" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>车辆列表</title>
    <link href="/jqPlugin/jqTab/ui.tabs.css" rel="stylesheet" type="text/css" />

    <script src="/jqPlugin/jqTab/ui.tabs.js" type="text/javascript"></script>

    <link href="/jqPlugin/kindeditor/themes/default/default.css" type="text/css" rel="stylesheet" />
    <script src='/??jqPlugin/kindeditor/kindeditor.js,jqPlugin/kindeditor/lang/zh_CN.js'
        type='text/javascript'></script>
    <script src="/themes/wStyle1/js/comm/VerifyJs.js"></script>
    <style type="text/css">
        html, body {
            overflow: hidden;
            margin-left: 0px;
            margin-top: 0px;
            margin-right: 0px;
            margin-bottom: 0px;
        }
    </style>
    <script type="text/javascript">
        K = KindEditor;
        //        K.DEBUG = true;
        K.basePath = K.options.basePath = '/jqPlugin/kindeditor/';
        K.options.themesPath = K.options.basePath + 'themes/';
        K.options.langPath = K.options.basePath + 'lang/';
        K.options.pluginsPath = K.options.basePath + 'plugins/';

        var jlueditor7 = function () {
            var editor = new Sigma.Editor();
            var input = Sigma.$e('input', { type: 'text', value: editor.defaultValue || '', className: 'gt-editor-text', style: { width: '78px', styleFloat: 'left' } });
            var button = Sigma.$e('input', { type: 'button', value: editor.defaultValue || '', className: 'gt-editor-date', styleFloat: 'left' });
            editor.dom.style.overflow = 'hidden';
            editor.dom.appendChild(input);
            editor.dom.appendChild(button);

            editor.setSize = function (w, h) {
                this.width = w || this.width;
                this.height = h || this.height;
                if (this.width / 1 && this.width > 0) {
                    this.dom.style.width = (this.width - 1) + 'px';
                }
                if (this.height / 1 && this.height > 0) {
                    this.dom.style.height = (this.height - 1) + 'px';
                }
                this.dom.firstChild.style.width = (this.width - 20) + 'px';
            };


            var fillDate = function (imgurl, editorfile) {
                $(input).val(imgurl);
                editor.onClose && editor.onClose();
                editorfile.hideDialog();
            };

            var showCalendar = function () {
                var editorfile = K.editor({
                    allowFileManager: true
                });
                editorfile.fileManagerJson = '/pgajax.axd?F_MANA=1&rType1=0&rType2=0&COOKATHID=' + (typeof (cookesc) == "undefined" ? "" : cookesc)
                                    + "&fType=" + "image";
                editorfile.loadPlugin('filemanager', function () {
                    editorfile.plugin.filemanagerDialog({
                        viewType: 'VIEW',
                        dirName: 'image',
                        clickFn: function (url, title) {
                            fillDate(url, editorfile);
                        }
                    });
                });

            };
            Sigma.U.addEvent(button, 'click', showCalendar);

            editor.valueDom = input;
            return editor;
        };

        function viewItem(sid, reqType) {
            if (reqType == "upVehicle") {
                OpenDialog("/h_VehicleEdit.htm?vehicleId=" + sid, null, null, "修改车辆信息");
            }
            else if (reqType == "schedule") {
                OpenDialog("/h_ScheduleModify.htm?vehicleId=" + sid, null, null, "查看车辆日程");
            }
        };

        function setSelect(inpuId, data) {
            if (IsNull(data)) {
                return;
            }
            var select = $("#" + inpuId);
            select.html("");
            for (var i = 0; i < data.rows.length; i++) {
                select.append("<option value='" + data.rows[i]["enum_Value"] + "'>" + data.rows[i]["enum_Name"] + "</option>")
            }

        }




        //显示地区
        function setCity(data, selectId, selectCity) {
            if (IsNull(data) || data.rows.length < 1) {
                return;
            }
            $("#" + selectId).html("");
            var cityName = "";
            for (var i = 0; i < data.rows.length; i++) {
                if (data.rows[i].COUNTRY_CITY_ID == selectCity) {
                    $("#" + selectId).append("<option selected='selected' value='" + data.rows[i].COUNTRY_CITY_ID + "'>" + data.rows[i].COUNTRY_CITY_NME + "</option>");
                    cityName = data.rows[i].COUNTRY_CITY_NME;
                } else {
                    $("#" + selectId).append("<option value='" + data.rows[i].COUNTRY_CITY_ID + "'>" + data.rows[i].COUNTRY_CITY_NME + "</option>");
                }
            }
            if (IsNull(cityName)) {
                cityName = data.rows[0].COUNTRY_CITY_NME;
            }
        }

        //要自定义显示，比如链接等字段如下buynow,在renderer函数中返回要显示的HTML编码字符
        var colsOption = [
            {
                id: 'VehicleInfo', header: "操作", width: 100, resizable: false, filterable: false, exportable: false, sortable: false, printable: false,
                renderer: function (value, record, columnObj, grid, colNo, rowNo) {
                    var html = " &nbsp&nbsp<a  href=\"javascript:void(0);return false;\" onclick=\"javascript:viewItem('" + record.VEHICLE_INFO_ID + "','upVehicle');return false;\" target='_self'>编辑车辆</a>";
                    return html;
                }
            },
            { id: 'VEHICLE_INFO_ID', hidden: true, filterable: false, exportable: false },
            { id: 'DJACK_ID', hidden: true, filterable: false, exportable: false },
            { id: 'LICENSE_PLATE_NUMBER', header: "车牌号码", width: 130 },
            {
                id: 'VEHICLE_DEFAULT_PIC', header: "车辆图标", width: 100, renderer: function (value, record, columnObj, grid, colNo, rowNo) {
                    if (record.VEHICLE_DEFAULT_PIC != "") {
                        return "<img src=" + record.VEHICLE_DEFAULT_PIC + " style='width:100px;height:100px;' />";
                    } else {
                        return "";
                    }
                }
            },
            { id: 'VEHICLE_NAME', header: "车辆名称", width: 160 },
            { id: 'VEHICLE_BRAND_NAME', header: "车辆品牌", width: 60 },
            { id: 'VEHICLE_TYPE_NAME', header: "车辆类型", width: 60 },
            { id: 'VEHICLE_COLOR_NAME', header: "车辆颜色", width: 60 },
            { id: 'VEHICLE_SERVICE_TYPE_NAME', header: "服务类型", width: 100 },
            { id: 'VEHICLE_SEATS', header: "座位数", width: 60 },
            { id: 'VEHICLE_PRICE_DAY', header: "车辆价格", width: 100 },
            { id: 'COUNTRY_NAME', header: "国家", width: 100 },
            { id: 'CITY_NAME', header: "城市", width: 100 },
            { id: 'D_NAME', header: "地区", width: 100 },
            { id: 'CUSTOMER_NICK', header: "地接客者", width: 130 },

            { id: 'FACCOUNT_NAME', header: "代理人", width: 130 },
                {
                    id: 'Calendar', header: "日历", width: 100, resizable: false, filterable: false, exportable: false, sortable: false, printable: false,
                    renderer: function (value, record, columnObj, grid, colNo, rowNo) {
                        var html = " &nbsp&nbsp<a  href=\"javascript:void(0);return false;\" onclick=\"javascript:viewItem('" + record.VEHICLE_INFO_ID + "','schedule');return false;\" target='_self'>查看日历</a>";
                        return html;
                    }
                },
        ];

        function btnDo(sEbtn) {
            GtGrid1Action = sEbtn;
            var opart = GetGtParam("myGrid1");
            if (sEbtn == "mFinder") {
                doFinderGt('myGrid1');
            }
            GtGrid1Action = "";
        };

        //以下为固定的代码
        var gridOption1 = getGtOp('myGrid1', colsOption, 'gridbox1', 'BANK_ID');
        var mygrid1 = new Sigma.Grid(gridOption1);
        ///////////////////////////////////////
        function GetGtParam(jqGridID) {
            var _jsParam = new jsonRow();
            if (jqGridID == "myGrid1") {
                GetFormJson("divCondition", _jsParam);
                _jsParam.AddCell("PPAGE", "wfConstantHandle"); //这个地方是该页面的类名
                _jsParam.AddCell("gtGridID", "myGrid1");
                _jsParam.AddCell("sRadom", $("#sRadom").val());
                _jsParam.AddCell("destinationId", $("#selDestination").val());
                _jsParam.AddCell("cityId", $("#selCity").val());
                _jsParam.AddCell("countryId", $("#selCountry").val());
                _jsParam.AddCell("brand", $("#vehicleBrand").val());
                _jsParam.AddCell("minseats", $.trim($("#txtMinSteas").val()));
                _jsParam.AddCell("maxseats", $.trim($("#txtMaxSteas").val()));
                _jsParam.AddCell("vehicleNumber", $.trim($("#txtVehicleNumber").val()));
                _jsParam.AddCell("proxy", $.trim($("#txtProxyName").val()));
                _jsParam.AddCell("startTime", $.trim($("#txtINITIAL_DT_S").val()));
                _jsParam.AddCell("endTime", $.trim($("#txtINITIAL_DT_E").val()));
                _jsParam.AddCell("ACTION", GtGrid1Action);
                //这里可增加传入后台的参数
            } return _jsParam;
        };
        $(window).load(function () {
            //初始化步进式搜索框
            GtGrid1Action = "init";
            mygrid1.render();
            mygrid1.readOnly = true;
            $('#txtINITIAL_DT_S').date_input('%Y-%m-%d');
            $('#txtINITIAL_DT_E').date_input('%Y-%m-%d');
            //autogtResize("bigbox2", mygrid1);
            //SetBtnEnable('btnEdit', 'btnSave,btnNotSave,btnConfirm,btnCancel');
            $("#selCountry").change(function () {
                var countryId = $(this).val();
                if (IsNull(countryId)) {
                    $("#selCity").html("<option value=''>请选择</option>");
                    $("#selDestination").html("<option value=''>请选择</option>");
                } else {
                    var _jsParam = new jsonRow();
                    _jsParam.AddCell("parentsId", countryId);
                    _jsParam.AddCell("ACTION", "upCountry");
                    ajaxComm(_jsParam);
                }
                //btnDo("upCountry")
            });

            $("#selCity").change(function () {
                var cityId = $(this).val();
                if (IsNull(cityId)) {
                    $("#selDestination").html("<option value=''>请选择</option>");
                }
                else {
                    var _jsParam = new jsonRow();
                    _jsParam.AddCell("parentsId", cityId);
                    _jsParam.AddCell("ACTION", "upCity");
                    ajaxComm(_jsParam);
                }

            })
        });
    </script>
</head>
<body>
    <form id="wfConstantHandle" method="post" runat="server">
        <asp:HiddenField ID="txtStatus" runat="server" Value="0" />
        <div style="width: 100%; text-align: left; margin: 0px 0px 0px 0px;">
            <div id="container2" style="width: 100%; margin-top: 3px;">
                <div id="fragment1">
                    <div id="divCondition" style="margin: 0px; border-style: solid; border-width: 1px; border-color: #C8D2E0;">
                        <table border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td class="label" width="90px">车牌号
                                </td>
                                <td align="right" width="110px">
                                    <asp:TextBox ID="txtVehicleNumber" runat="server" Width="140px" MaxLength="100"></asp:TextBox>

                                </td>
                                <td class="label" width="90px">代理人
                                </td>
                                <td align="right" width="100px">
                                    <asp:TextBox ID="txtProxyName" runat="server" Width="140px" MaxLength="100"></asp:TextBox>
                                </td>
                                <td class="label" width="90px">座位数
                                </td>
                                <td align="left" width="110px">
                                    <asp:TextBox ID="txtMinSteas" runat="server" Width="80px" MaxLength="100"></asp:TextBox>
                                    ~
                                </td>
                                <td class="label" width="80px">
                                    <asp:TextBox ID="txtMaxSteas" runat="server" Width="80px" MaxLength="100"></asp:TextBox>
                                </td>

                            </tr>
                            <tr>
                                <td class="label" width="90px">代理区域
                                </td>
                                <td align="left" colspan="3">
                                    <select style="width: 100px;" id="selCountry">
                                        <option value="">请选择</option>
                                        <option value="DF6723BE-A25C-4F77-BB49-A1662D3E6F2A">中国</option>
                                        <option value="453370FE-8295-41EC-A41C-B6F650AD1B4C">亚洲</option>
                                        <option value="927D5F28-C4FB-46A9-940C-B07DF0A04018">北美洲</option>
                                        <option value="1FEAF456-7C76-41C8-A3D0-F9C12415A736">南美洲</option>
                                        <option value="4E2B4524-E9CB-4E20-9224-E58EB636D1C7">非洲</option>
                                        <option value="67FA6A8D-951C-4B53-AE1E-70DCB97E11DE">欧洲</option>
                                        <option value="0B772F3D-D8F8-42E3-9019-81FE6F772236">大洋洲</option>
                                    </select>
                                    <select style="width: 100px;" id="selCity"><option value="">请选择</option></select>
                                    <select style="width: 100px;" id="selDestination"><option value="">请选择</option></select>
                                </td>
                                <td class="label" width="90px">车辆品牌
                                </td>
                                <td align="left" width="110px" colspan="2">
                                    <select style="width: 100px;" id="vehicleBrand">
                                        <option value="0">请选择</option>
                                    </select>
                                </td>
                            </tr>
                            <tr colspan="3">
                                <td class="label" width="90px">空闲时间段
                                </td>
                                 <td align="left" colspan="3">
                                    <asp:TextBox ID="txtINITIAL_DT_S" runat="server" Width="80px" MaxLength="100"></asp:TextBox>
                                    ~
                                     <asp:TextBox ID="txtINITIAL_DT_E" runat="server" Width="80px" MaxLength="100"></asp:TextBox>
                                </td>
                                <td>
                                    <input type="button" onclick="javascript: btnDo('mFinder'); return false;" value="查询(F)"
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div id="bigbox2" style="margin: 0px; margin-top: 2px;">
                        <div id="gridbox1" style="border: 0px solid #cccccc; background-color: #f3f3f3; padding: 5px;">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
</body>
</html>
